From 2715b3ec31256ee1c3e0276fdc0154cd8a69fa8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Fri, 25 Sep 2020 14:27:26 +0200 Subject: [PATCH] buildable: Make vfunc accessor functions private With the exception of gtk_buildable_get_id(), those are only used to construct objects from XML descriptions, which is functionality internal to GTK. The API is therefore unlikely to be missed, and keeping it internal means they can no longer unintentionally shadow object methods in bindings with less namespacing; for example it's currently ambiguous whether `infoBar.add_child()` refers to gtk_info_bar_add_child() or gtk_buildable_add_child(). https://gitlab.gnome.org/GNOME/gtk/-/issues/3191 --- docs/reference/gtk/gtk4-sections.txt | 9 ------ gtk/gtkbuildable.c | 2 +- gtk/gtkbuildable.h | 43 -------------------------- gtk/gtkbuildableprivate.h | 45 ++++++++++++++++++++++++++++ gtk/gtkbuilder-menus.c | 1 + gtk/gtkbuilder.c | 2 +- gtk/gtkbuilderparser.c | 2 +- gtk/gtkbuilderprecompile.c | 2 +- 8 files changed, 50 insertions(+), 56 deletions(-) create mode 100644 gtk/gtkbuildableprivate.h diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index d93c23e297..b0bbd9cb1d 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -617,16 +617,7 @@ gtk_grid_view_get_type GtkBuildable GtkBuildableIface GtkBuildableParser -gtk_buildable_set_buildable_id gtk_buildable_get_buildable_id -gtk_buildable_add_child -gtk_buildable_set_buildable_property -gtk_buildable_construct_child -gtk_buildable_custom_tag_start -gtk_buildable_custom_tag_end -gtk_buildable_custom_finished -gtk_buildable_parser_finished -gtk_buildable_get_internal_child GTK_BUILDABLE GTK_IS_BUILDABLE diff --git a/gtk/gtkbuildable.c b/gtk/gtkbuildable.c index 8e73e20b4a..dd0e33040d 100644 --- a/gtk/gtkbuildable.c +++ b/gtk/gtkbuildable.c @@ -36,7 +36,7 @@ */ #include "config.h" -#include "gtkbuildable.h" +#include "gtkbuildableprivate.h" #include "gtkintl.h" diff --git a/gtk/gtkbuildable.h b/gtk/gtkbuildable.h index 9cb69dcaa3..ed0dbdd25a 100644 --- a/gtk/gtkbuildable.h +++ b/gtk/gtkbuildable.h @@ -168,51 +168,8 @@ struct _GtkBuildableIface GDK_AVAILABLE_IN_ALL GType gtk_buildable_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL -void gtk_buildable_set_buildable_id (GtkBuildable *buildable, - const char *id); GDK_AVAILABLE_IN_ALL const char * gtk_buildable_get_buildable_id (GtkBuildable *buildable); -GDK_AVAILABLE_IN_ALL -void gtk_buildable_add_child (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const char *type); -GDK_AVAILABLE_IN_ALL -void gtk_buildable_set_buildable_property (GtkBuildable *buildable, - GtkBuilder *builder, - const char *name, - const GValue *value); -GDK_AVAILABLE_IN_ALL -GObject * gtk_buildable_construct_child (GtkBuildable *buildable, - GtkBuilder *builder, - const char *name); -GDK_AVAILABLE_IN_ALL -gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const char *tagname, - GtkBuildableParser *parser, - gpointer *data); -GDK_AVAILABLE_IN_ALL -void gtk_buildable_custom_tag_end (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const char *tagname, - gpointer data); -GDK_AVAILABLE_IN_ALL -void gtk_buildable_custom_finished (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const char *tagname, - gpointer data); -GDK_AVAILABLE_IN_ALL -void gtk_buildable_parser_finished (GtkBuildable *buildable, - GtkBuilder *builder); -GDK_AVAILABLE_IN_ALL -GObject * gtk_buildable_get_internal_child (GtkBuildable *buildable, - GtkBuilder *builder, - const char *childname); GDK_AVAILABLE_IN_ALL void gtk_buildable_parse_context_push (GtkBuildableParseContext *context, diff --git a/gtk/gtkbuildableprivate.h b/gtk/gtkbuildableprivate.h new file mode 100644 index 0000000000..305be21898 --- /dev/null +++ b/gtk/gtkbuildableprivate.h @@ -0,0 +1,45 @@ +#ifndef __GTK_BUILDABLE_PRIVATE_H__ +#define __GTK_BUILDABLE_PRIVATE_H__ + +#include "gtkbuildable.h" + +G_BEGIN_DECLS + +void gtk_buildable_set_buildable_id (GtkBuildable *buildable, + const char *id); +void gtk_buildable_add_child (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const char *type); +void gtk_buildable_set_buildable_property (GtkBuildable *buildable, + GtkBuilder *builder, + const char *name, + const GValue *value); +GObject * gtk_buildable_construct_child (GtkBuildable *buildable, + GtkBuilder *builder, + const char *name); +gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const char *tagname, + GtkBuildableParser *parser, + gpointer *data); +void gtk_buildable_custom_tag_end (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const char *tagname, + gpointer data); +void gtk_buildable_custom_finished (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const char *tagname, + gpointer data); +void gtk_buildable_parser_finished (GtkBuildable *buildable, + GtkBuilder *builder); +GObject * gtk_buildable_get_internal_child (GtkBuildable *buildable, + GtkBuilder *builder, + const char *childname); + +G_END_DECLS + +#endif /* __GTK_BUILDABLE_PRIVATE_H__ */ diff --git a/gtk/gtkbuilder-menus.c b/gtk/gtkbuilder-menus.c index aca07e3f2e..0bc7c1ed78 100644 --- a/gtk/gtkbuilder-menus.c +++ b/gtk/gtkbuilder-menus.c @@ -20,6 +20,7 @@ #include "config.h" #include "gtkbuilderprivate.h" +#include "gtkbuildableprivate.h" #include "gtkintl.h" #include diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index 1e079c2ccc..cb2bcf0236 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -206,7 +206,7 @@ #include "gtkbuilderprivate.h" #include "gdkpixbufutilsprivate.h" -#include "gtkbuildable.h" +#include "gtkbuildableprivate.h" #include "gtkbuilderlistitemfactory.h" #include "gtkbuilderscopeprivate.h" #include "gtkdebug.h" diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c index 78385499a9..3ea04b941f 100644 --- a/gtk/gtkbuilderparser.c +++ b/gtk/gtkbuilderparser.c @@ -20,7 +20,7 @@ #include "gtkbuilderprivate.h" -#include "gtkbuildable.h" +#include "gtkbuildableprivate.h" #include "gtkbuilderscopeprivate.h" #include "gtkdebug.h" #include "gtkintl.h" diff --git a/gtk/gtkbuilderprecompile.c b/gtk/gtkbuilderprecompile.c index 9360dc1606..4a06a2393e 100644 --- a/gtk/gtkbuilderprecompile.c +++ b/gtk/gtkbuilderprecompile.c @@ -21,7 +21,7 @@ #include #include "gtkbuilderprivate.h" #include "gtkbuilder.h" -#include "gtkbuildable.h" +#include "gtkbuildableprivate.h" /***************************************** Record a GMarkup parser call ***************************/ -- 2.30.2